package com.bulls.demo.hrmsdemo.service;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import com.bulls.demo.hrmsdemo.db.Person;
import com.bulls.demo.hrmsdemo.ib.SignupLogic;

public class SignupService {
	
    private static EntityManager em=null;

    EntityManagerFactory emf;
    
    public EntityManager getEntityManager(){


        emf = Persistence.createEntityManagerFactory("pu");
        if(emf == null){
        	System.out.println("em is null");
        }else{
        	System.out.println("em is created");
        }
        em = emf.createEntityManager();
        System.out.println("em is created="+em);
		return em;
    }

	public Person save(Person person) {
		// TODO Auto-generated method stub
		return SignupLogic.save(person,getEntityManager());
	}
	
	

}
